package com.controller.message;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.po.HandBookInfo;
import com.po.SystemMessageInfo;
import com.service.message.HandBookService;
import com.service.message.SystemMessageService;
import com.util.UUIDGenerator;

@Controller
@RequestMapping("/jsp/systemMessage")
public class SystemMessageController {
	@Resource(name = "systemMessageServiceImp")
	private SystemMessageService systemMessageService;
	@Resource(name = "handBookServiceImp")
	private HandBookService handBookService;
	// 系统提问
	@ResponseBody
	@RequestMapping(value = "/addSystemMessage")
	public int addSystemMessage(HttpServletRequest request, SystemMessageInfo systemMessageInfo) {
		String userid = request.getSession().getAttribute("user_id").toString();
		String id = UUIDGenerator.getUUID();
		systemMessageInfo.setSysmess_user_id(userid);
		systemMessageInfo.setSysmess_id(id);
		int i = systemMessageService.addSystemMessage(systemMessageInfo);
		return i;
	}

	// 计算系统问题数量
	@ResponseBody
	@RequestMapping(value = "/getSystemMessageCount")
	public int getSystemMessageCount(SystemMessageInfo systemMessageInfo) {
		int i = systemMessageService.getSystemMessageCount(systemMessageInfo);
		return i;
	}

	// 计算系统问题数量
	@ResponseBody
	@RequestMapping(value = "/getSystemMessageList")
	public List<SystemMessageInfo> getSystemMessageList(SystemMessageInfo systemMessageInfo) {
		List<SystemMessageInfo> list = systemMessageService.getSystemMessageList(systemMessageInfo);
		return list;
	}

	// 计算常见问题数量
	@ResponseBody
	@RequestMapping(value = "/getHandBookCount")
	public int getHandBookCount(HandBookInfo handBookInfo) {
		int i = handBookService.getHandBookCount(handBookInfo);
		return i;
	}

	// 计算常见问题数量
	@ResponseBody
	@RequestMapping(value = "/getHandBookList")
	public List<HandBookInfo> getHandBookList(HandBookInfo handBookInfo) {
		List<HandBookInfo> list = handBookService.getHandBookList(handBookInfo);
		return list;
	}
}
